home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_all.zip / TI118.ASC < prev    next >
Text File  |  1992-08-12  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.   PRODUCT : TURBO PASCAL                               NUMBER : 118
  10.   VERSION : 2.00x
  11.        OS : PC-DOS, MS-DOS
  12.      DATE : March 13, 1986                               PAGE : 1/2
  13.     TITLE : REDIRECTION OF INPUT/OUTPUT
  14.  
  15.  
  16.  
  17.  
  18.   This program demonstrates user defined INPUT and OUTPUT device
  19.   drivers. Use the indicated portion of the sample program as an
  20.   INCLUDE file to be inserted in declaration section of your
  21.   program files.
  22.  
  23.   The MS-DOS facilities of redirection, piping, and simultaneous
  24.   printing through the use of ^P or ^PrtSc will be re-enabled. At
  25.   the beginning of your main program, place the statements
  26.   (ConInPtr:=Ofs(GetC);) and (ConOutPtr:=Ofs(PutC);). The INPUT and
  27.   OU
  28.  
  29.   _________________________________________________________________
  30.  
  31.                        START OF INCLUDE FILE
  32.   _________________________________________________________________
  33.  
  34.   program Redirect:
  35.   Type RegRecord = Record Case Integer Of
  36.                      1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Integer);
  37.                      2: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);
  38.                    End;
  39.  
  40.   Var    Regs    : RegRecord;
  41.  
  42.   Function GetC: Byte;
  43.  
  44.   Begin
  45.     Regs.AH:=8;
  46.     MsDos(Regs);
  47.     GetC:=Regs.AL;
  48.   End;
  49.  
  50.   Procedure PutC(C: Byte);
  51.  
  52.   Begin
  53.     Regs.AH:=2;
  54.     Regs.DL:=C;
  55.     MsDos(Regs);
  56.   End;
  57.  
  58.   ________________________________________________________________
  59.  
  60.                          END OF INCLUDE FILE
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.   PRODUCT : TURBO PASCAL                               NUMBER : 118
  76.   VERSION : 2.00x
  77.        OS : PC-DOS, MS-DOS
  78.      DATE : March 13, 1986                               PAGE : 2/2
  79.     TITLE : REDIRECTION OF INPUT/OUTPUT
  80.  
  81.  
  82.  
  83.  
  84.   _________________________________________________________________
  85.  
  86.   Var  Str    : String [255];
  87.        I     : integer;
  88.        Answer : char;
  89.  
  90.  
  91.   begin
  92.     ConInPtr:=Ofs(GetC);         { Include these lines at the   }
  93.     ConOutPtr:=Ofs(PutC);       { start of your program     }
  94.     repeat
  95.       ClrScr;
  96.       writeln ('This is a test of INPUT/OUTPUT redirection:  ');
  97.       writeln;
  98.       for I := 1 to 128 do     { demonstrates formated output }
  99.         write (1:5);
  100.       writeln; writeln;
  101.       writeln ('Enter a String of characters from the keyboard.');
  102.       writeln;
  103.       readln (Str);
  104.       writeln;
  105.       writeln (Str);
  106.       writeln; writeln;
  107.       writeln ('Run again? (Y/N)'); writeln;
  108.       writeln ('Type <Ctrl> <P> first to test output to PRINTER/CRT');
  109.       repeat
  110.         read (kbd,Answer);
  111.       until upcase (Answer) in ['Y','N'];
  112.       writeln;
  113.       writeln;
  114.     until upcase (Answer) = 'N';
  115.   end.
  116.  
  117.   DISCLAIMER: You have the right to use this technical information
  118.   subject to the terms of the No-Nonsense License Statement that
  119.   you received with the Borland product to which this information
  120.   pertains.
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.